var warn = document.getElementById("warn")
var btn = document.getElementById("btn")
btn.onclick = function (){
    warn.innerText=''
    var uname=document.getElementById('uname').value
    var pwd=document.getElementById("pwd").value
    var xhr = new XMLHttpRequest()
    var params ="uname="+uname+"&pwd="+pwd
    xhr.open("get","http://localhost:9001/login?"+params,true)
    xhr.send()
    xhr.onload = function (){
        let l= xhr.responseText
        console.log(xhr.responseText);
        if (l==="submit") window.location.href="http://localhost:8888/submit.html"
        if (l==="admin") window.location.href="http://localhost:8888/admin?name="+uname
        if (l==="index") window.location.href="http://localhost:8888?name="+uname
        if (l==="shop") window.location.href="http://localhost:8888/shop?name="+uname
        if (l==="baned") window.location.href="http://localhost:8888/baned"
        if (l==="login") warn.innerText="账号或密码错误"

    }
}